@import "./_color.less";

.artalk {
  position: relative;
  width: 100%;
  min-height: 200px;
}

.artalk, .artalk-layer-wrap {
  * {
    box-sizing: border-box;
    line-height: @line-height;
    color: @color-font;
    font-family: @font-family;
    word-wrap: break-word;
    word-break: break-all;
  }

  pre {
    padding: 10px;
    line-height: @line-height;
    background-color: @color-bg-grey;
    color: @color-font;
    padding: 5px 10px;
    border-radius: @block-radius/2;
    margin: 0;
    font-family: Source Code Pro,courier new,Input Mono,PT Mono,SFMono-Regular,Consolas,Monaco,Menlo,PingFang SC,Liberation Mono,Microsoft YaHei,Courier,monospace;
  }

  a {
    color: @color-main;
    text-decoration: none;
  }

  blockquote {
    position: static;
    margin: 10px 0 10px 0;
    padding: 10px 20px 10px 20px;
    background: @color-bg-grey;
    border-left: 4px solid @color-quote;
  }

  p:first-child {
    margin-top: 0;
  }

  p:last-child {
    margin-bottom: 0;
  }

  * {
    box-sizing: border-box;
  }

  img {
    max-width: 100%;
  }
}

.full-layer {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  background: @color-bg;
  z-index: 10;
  align-items: center;
  justify-content: center;
  flex-flow: column;
  display: flex;
}

/* Loading */
.artalk-loading {
  z-index: 11;
  &:extend(.full-layer);
}

.artalk-loading-spinner {
  position: relative;
  width: 50px;
  height: 50px;

  svg {
    animation: artalkRotate 2s linear infinite;
    transform-origin: center center;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;

    circle {
      stroke-dasharray: 1,200;
      stroke-dashoffset: 0;
      animation: artalkDash 1.5s ease-in-out infinite, artalkColor 6s ease-in-out infinite;
      stroke-linecap: round
    }
  }
}

@keyframes artalkRotate {
  100% { transform: rotate(360deg) }
}

@keyframes artalkDash {
  0% {
    stroke-dasharray: 1,200;
    stroke-dashoffset: 0
  }

  50% {
    stroke-dasharray: 89,200;
    stroke-dashoffset: -35px
  }

  100% {
    stroke-dasharray: 89,200;
    stroke-dashoffset: -124px
  }
}

@keyframes artalkColor {
  0%,100% { stroke: #ff5652 }
  40% { stroke: #2196F3 }
  66% { stroke: #32c787 }
  80%,90% { stroke: #ffc107 }
}

@keyframes artalkLoadingIconRotate {
  0% { transform: rotate(0) }
  100% { transform: rotate(360deg) }
}

.artalk-loading-icon {
  width: 18px;
  height: 18px;
  box-sizing: border-box;
  border: solid 1px transparent;
  border-top-color: #29d;
  border-left-color: #29d;
  border-radius: 50%;
  animation: artalkLoadingIconRotate .4s linear infinite;
}

/* Animations */
.artalk-fade-in {
  animation: artalkFadeIn both .3s;
}

.artalk-fade-out {
  animation: artalkFadeOut both .2s;
}

@keyframes artalkFadeIn {
  0% { opacity: 0 }
  to { opacity: 1 }
}

@keyframes artalkFadeOut {
  100% { opacity: 0; }
  0% {}
}

/* Layer */
.artalk-error-layer {
  &:extend(.full-layer);
  background-color: @color-bg-transl;

  .artalk-error-title {
    color: @color-red;
  }

  .artalk-error-text {
    text-align: center;
  }
}

.artalk-layer-dialog-wrap {
  @formInputHeight: 30px;
  &:extend(.full-layer);
  background-color: @color-bg-transl;

  & > .artalk-layer-dialog {
    width: 25%;

    & > .artalk-layer-dialog-content {
      .artalk-captcha-img {
        cursor: pointer;
        width: 100px;
        height: auto;
        margin-right: 10px;
        padding-right: 10px;
        border-right: 1px solid @color-border;
        vertical-align: bottom;
      }

      input {
        width: 100%;
        line-height: @formInputHeight + 4px;
        background-color: @color-bg;
        border: 1px solid @color-border;
        border-radius: @block-radius/2;
        outline: none;
        padding: 0 6px;
        display: block;
        margin-top: 10px;
        margin-bottom: 5px;
        text-align: center;
      }
    }

    & > .artalk-layer-dialog-action {
      display: flex;
      flex-direction: row;

      button {
        flex: 1;
        display: block;
        cursor: pointer;
        border: 1px solid @color-main;
        background: transparent;
        color: @color-main;
        border-radius: @block-radius/2;
        padding: 0 15px;
        line-height: @formInputHeight;
        outline: none;

        &:active {
          color: #FFF;
          background: @color-main;
        }

        &:not(:last-child) {
          margin-right: 5px;
        }

        &.error {
          color: #FFF;
          background: #ff5652;
          border-color: #ff5652;
        }
      }
    }
  }
}

@media only screen and (max-width: 768px) {
  .artalk-layer-dialog-wrap > .artalk-layer-dialog {
      width: 90% !important;
  }
}

.artalk-notify {
  display: block;
  overflow: hidden;
  background-color: #2c2c2c;
  color: #FFF;
  border-radius: 2px;
  cursor: pointer;
  font-size: 14px;
  padding: 4px 15px;

  &:not(:last-child) {
    margin-bottom: 3px;
  }

  .artalk-notify-content {
    color: #FFF;
  }
}

.artalk-layer-wrap {
  .artalk-layer-mask {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99998;
    background: rgba(0, 0, 0, .3);
  }

  .artalk-layer-item {
    position: fixed;
    z-index: 99999;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
  }
}
